#include "armor.h"
#include <cmath>

Armor::Armor() : number_(-1), confidence_(0.0), distance_(0.0) {}

Armor::Armor(const cv::Rect& rect, const cv::Point2f& center, 
             const std::vector<cv::Point2f>& points, int number)
    : bounding_rect_(rect), center_(center), points_(points), 
      number_(number), confidence_(0.0), distance_(0.0) {}

void Armor::setPose(const cv::Mat& rvec, const cv::Mat& tvec) {
    rvec_ = rvec.clone();
    tvec_ = tvec.clone();
    
    // 计算距离
    distance_ = cv::norm(tvec);
}